package demo.springboottrans;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import demo.hello.User;

@SpringBootApplication
public class RocketmqLaunch implements CommandLineRunner {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    
    public static void main(String[] args) {
        SpringApplication.run(RocketmqLaunch.class, args);
    }

    public void run(String... args) throws Exception {
        DefaultMQProducer producer = rocketMQTemplate.getProducer();
        System.out.println(producer);
        System.out.println("rocketMQTemplate3:"+rocketMQTemplate);
        User user = new User();
        user.setName("jack");
        user.setSex("1");
        rocketMQTemplate.syncSend("TopicTest5", user);
        
    }
}


